﻿<UserControl x:Class="AnthStat.WPF.Presentation.Controls.NutritionalCalculator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:p="clr-namespace:AnthStat.WPF.Presentation.Properties"
             xmlns:controls="clr-namespace:AnthStat.WPF.Presentation.Controls"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="530" d:DesignWidth="700">
    <Border BorderBrush="{StaticResource AccentVeryLightBrush}" BorderThickness="1" Background="White" Padding="10">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Margin="0, 0, 0, 20">
                <TextBlock FontWeight="SemiBold" FontSize="24" Text="ANTHROPOMETRIC CALCULATOR"/>
                
                <StackPanel Height="20" />
                
                <Grid DataContext="{Binding MockPerson}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="5" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="20" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="10" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0" FontSize="14" Text="Date of birth" />
                    <TextBlock Grid.Column="0" Grid.Row="2" FontSize="14" Text="Sex" />
                    <CheckBox x:Name="checkboxIsDOBEstimated" Grid.Column="4" Grid.Row="0" FontSize="14" Content="Estimated" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding IsDateBirthEstimated, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

                    <DatePicker Grid.Column="2" Grid.Row="0" HorizontalAlignment="Stretch" SelectedDate="{Binding DateBirth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />
                    <StackPanel Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal" VerticalAlignment="Center" >
                        <RadioButton GroupName="GROUP_1" VerticalAlignment="Center" Content="Male" IsChecked="{Binding Sex, Mode=TwoWay, Converter={StaticResource MaleToCheckedConverter}}" />
                        <StackPanel Width="10" />
                        <RadioButton GroupName="GROUP_1" VerticalAlignment="Center" Content="Female"  IsChecked="{Binding Sex, Mode=TwoWay, Converter={StaticResource FemaleToCheckedConverter}}" />
                    </StackPanel>
                </Grid>
                
                


                
                <!--<TextBlock FontWeight="Normal" FontSize="12" Foreground="{StaticResource AccentBrush}" Text="Individual Assessments"/>-->
            </StackPanel>

            <StackPanel Grid.Row="1" DataContext="{Binding MockPerson.MeasurementsView.CurrentItem}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="20" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    
                    <controls:MeasurementInputs Grid.Column="0" 
                                                AllowsDirectAgeInput="{Binding Path=IsChecked, ElementName=checkboxIsDOBEstimated}"
                                                Visibility="{Binding Source={x:Static p:Settings.Default}, Path=MeasurementSystem, Mode=OneWay, Converter={StaticResource MetricSystemToVisibilityConverter}}"/>

                    <controls:MeasurementInputs Grid.Column="0" Style="{StaticResource ImperialMeasurementInputsStyle}" 
                                                AllowsDirectAgeInput="{Binding Path=IsChecked, ElementName=checkboxIsDOBEstimated}"
                                                Visibility="{Binding Source={x:Static p:Settings.Default}, Path=MeasurementSystem, Mode=OneWay, Converter={StaticResource ImperialSystemToVisibilityConverter}}"/>

                    <controls:IndicatorOutputsWHO Grid.Column="2" />
                </Grid>
                
                <StackPanel Height="10" />
            </StackPanel>

            <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Command="{Binding CalculatorCommand}" Content="Close" />
            </StackPanel>

        </Grid>
    </Border>
</UserControl>
